'''
图片抓取示例
'''
import requests
from fake_useragent import UserAgent

# image_url = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fs9.rr.itc.cn%2Fr%2FwapChange%2F20174_1_1%2Fa7dwfr16091600388405.jpg&refer=http%3A%2F%2Fs9.rr.itc.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1628238644&t=dafc07e8a8645b2873f0b8c255a74abd'
image_url = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fww3.sinaimg.cn%2Fmw690%2F0062GdbRgy1guv3phq1ugj60qo140aci02.jpg&refer=http%3A%2F%2Fwww.sina.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1635559413&t=cd8c9de3ff7e7e9f237c04b929608640'
headers = {'UserAgent':UserAgent(path='fake_useragent.json').random}

html = requests.get(url=image_url, headers=headers).content

with open('zly.jpg', 'wb') as f:
    f.write(html)

















